<% content_for :right do %>

<% if admin? %>
<h6><%= _('Admin') %></h6>
<p><%= link_to _('Create New Plate'), new_forum_path, :class => "utility" %></p>
<% end %>

<% end %>

<h1 style="margin-top:0;"><%= _('Ruby on Rails Chinese Community') %></h1>
<p class="subtitle">
<%= feed_icon_tag "Recent Posts", formatted_all_posts_path(:format => 'rss') %>
<%= number_with_delimiter(Topic.count) %> <%= _('topics') %>, <%= number_with_delimiter(Post.count) %> <%= _('posts') %>, 
<%= number_with_delimiter(User.count(:conditions => "posts_count>0")) %> <%= _('voices') %>
  
</p>

<table border="0" cellspacing="0" cellpadding="0" class="wide forums">
  <tr>
    <th class="la" width="70%" colspan="3"><%= 'Ruby on Rails' %></th>
<!--
    <th width="5%">Topics</th>
    <th width="5%">Posts</th>
-->
    <th class="la" width="30%" colspan="1"><%= _('Last Post') %></th>
  </tr>
<% for forum in @forums do %>  
  <tr>
    <td class="vat c1">
    
      <% if recent_forum_activity(forum) %>
      <%= image_tag "clearbits/comment.gif", :class => "icon green", :title => _('Recent activity') %>
      <% else %>
      <%= image_tag "clearbits/comment.gif", :class => "icon grey", :title => _('No recent activity') %>
      <% end %>
    </td>
    <td class="c2 vat">
      <%= link_to h(forum.name), forum_path(forum), :class => "title" %>
      <div class="posts">
        <%= number_with_delimiter(forum.topics_count) %> <%= _('topics') %>, 
        <%= number_with_delimiter(forum.posts_count) %> <%= _('posts') %>
      </div>
      <p class="desc"><%= forum.description_html %>
        </p>
    </td>
    <td class="c3">
      <%= link_to _('Edit'), edit_forum_path(forum), :class => "tiny", :rel => "directory", :style => "float:right" if admin? %>
    </td>
<!--
    <td class="ca inv"><%= number_with_delimiter(forum.topics_count) %></td>
    <td class="ca inv"><%= number_with_delimiter(forum.posts_count) %></td>
-->

    <td class="inv lp">
      <% if forum.posts.last %>
        <%= time_ago_in_words(forum.posts.last.created_at) %><br />
        by <strong><%= h(forum.posts.last.user.display_name) %></strong>
        <span>(<%= link_to _('view'), topic_path(:forum_id => forum, :id => forum.posts.last.topic_id, :page => forum.posts.last.topic.last_page, :anchor => forum.posts.last.dom_id) %>)</span>
      <% end %>
    </td>
  </tr>
<% end %>
</table>

<% online_users = User.currently_online -%>
<% unless online_users.empty? %>
<div class="stats">
<div class="users">
<% unless online_users.empty? %>
<%= _('Users online:') %> <%= online_users.map { |u| link_to "<strong>#{h u.display_name}</strong>", user_path(u) } * ", " %><br />
<% end %>
</div>
</div>
<% end %>

